/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author hancing.
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { TreeDataModel, TreeModel } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface DpType extends TreeModel<DpType> {
  treeCode?: string; // 分类编码
  treeName?: string; // 分类名称
}

export const dpTypeList = (params?: DpType | any) =>
  defHttp.get<DpType>({ url: adminPath + '/dp/dptype/dpType/list', params });

export const dpTypeListData = (params?: DpType | any) =>
  defHttp.post<DpType[]>({ url: adminPath + '/dp/dptype/dpType/listData', params });

export const dpTypeForm = (params?: DpType | any) =>
  defHttp.get<DpType>({ url: adminPath + '/dp/dptype/dpType/form', params });

export const dpTypeCreateNextNode = (params?: DpType | any) =>
  defHttp.get<DpType>({ url: adminPath + '/dp/dptype/dpType/createNextNode', params });

export const dpTypeSave = (params?: any, data?: DpType | any) =>
  defHttp.postJson<DpType>({ url: adminPath + '/dp/dptype/dpType/save', params, data });

export const dpTypeDelete = (params?: DpType | any) =>
  defHttp.get<DpType>({ url: adminPath + '/dp/dptype/dpType/delete', params });

export const dpTypeTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({ url: adminPath + '/dp/dptype/dpType/treeData', params });
